package com.ck.express.adapter

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.ck.express.enums.RecordTypeEnum
import com.ck.express.fragment.OperationRecordFragment

class RecordPagerAdapter(activity: AppCompatActivity) : FragmentStateAdapter(activity) {

    override fun getItemCount(): Int = 2

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> OperationRecordFragment.newInstance(RecordTypeEnum.DELIVERY)
            1 -> OperationRecordFragment.newInstance(RecordTypeEnum.LATTICE)
            else -> throw IllegalArgumentException("Invalid position")
        }
    }
}

